<!-- 优惠券组件 -->
<template>
  <div
    :style="{
      margin: '0 ' + config.ConfigData.margin + 'px',
      'background-color': config.ConfigData.bgcolor,
      'border-radius': config.ConfigData.radius + 'px'
    }"
  >
    <div
      :class="['couview', { getcoupc: config.ConfigData.istake }]"
      v-if="config.ConfigData.showtype === 1"
      :style="{ color: config.ConfigData.textcolor }"
    >
      <div class="money" :style="{ color: config.ConfigData.amountcolor }">
        ￥
        <div class="moneynum">
          {{ subStr(config.ConfigData.couponinfo.amount, 5, "..") }}
        </div>
      </div>
      <div class="content">
        <div class="name">
          {{ subStr(config.ConfigData.couponinfo.name, 16, "...") }}
        </div>
        <div class="limit" v-if="config.ConfigData.couponinfo.orderamount">
          满{{ config.ConfigData.couponinfo.orderamount }}可使用
        </div>
        <div class="limit" v-else>无门槛使用</div>
        <div class="usetime">
          使用时间:{{ config.ConfigData.couponinfo.userdatestr }}
        </div>
      </div>
      <div class="using" @tap="tapgetcoupon">
        {{ config.ConfigData.istake ? "立即使用" : "点击领取" }}
      </div>
      <img
        class="getimg"
        v-if="config.ConfigData.istake"
        :src="Medias.checkcoupon.getcoup"
        mode="widthFix"
        lazy-load
      />
    </div>
    <div class="diycoupon" v-if="config.ConfigData.showtype === 2">
      <img
        :style="{ 'border-radius': config.ConfigData.radius + 'px' }"
        v-if="config.ConfigData.istake"
        :src="config.ConfigData.imggetafter"
        mode="widthFix"
        lazy-load
      />
      <img
        :style="{ 'border-radius': config.ConfigData.radius + 'px' }"
        v-else
        :src="config.ConfigData.imggetbefore"
        mode="widthFix"
        lazy-load
      />
    </div>
  </div>
</template>

<script>
import { Medias } from "@/utils/constant";
export default {
  name: "CouponerCopt",
  props: {
    config: Object
  },
  data() {
    return {
      Medias: Medias
    };
  },
  methods: {
    rightnowuse() {},
    tapgetcoupon() {}
  },
  mounted() {
    this.Medias = Medias;
  }
};
</script>
<style lang="scss" scope>
.couview {
  //width: 710px;
  height: 76px;
  //margin: 0 20px;
  //background: #FCF3F1;
  // border-radius: 10px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 20px;
  .money {
    flex: 1;
    //  color: #FB4C34;
    font-size: 12px;
    display: flex;
    flex-direction: row;
    font-family: "PingFang-SC-Bold";
    font-weight: bold;
    line-height: 18px;
    .moneynum {
      font-size: 36px;
      line-height: 36px;
    }
  }
  .content {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    .name {
      font-size: 14px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500;
      // color: #FB4C34;
    }
    .limit {
      font-size: 10px;
      font-family: "PingFang-SC-Medium";
      border: 0.5px solid rgba(221, 221, 221, 0.5);
      padding: 1.5px 4.5px;
      font-weight: 500;
      // color: #FB4C34;
    }
    .usetime {
      font-size: 9px;
      font-family: "PingFang-SC-Medium";
      font-weight: 500;
      // color: #FB4C34;
    }
  }
  .using {
    text-align: right;
    flex: 1;
    font-size: 13px;
    font-family: "PingFang-SC-Bold";
    font-weight: bold;
    // color: #FB4C34;
  }
}
.getcoupc {
  position: relative;
  .getimg {
    width: 80px;
    height: 50px;
    position: absolute;
    top: 0;
    left: 80px;
  }
}
.diycoupon {
}
</style>
